<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <!--引入jquery 一定放在第一行  -->
    <script src="/js/jquery-1.8.0.js"></script>
    <!--引入my97  -->
    <script src="/js/my97/WdatePicker.js"></script>

    <!--引入uploadify的样式 -->
    <link rel="stylesheet" href="/js/uploadify/uploadify.css" />
    <script src="/js/uploadify/jquery.uploadify.min.js"></script>

    <!--引入kindedit的样式 -->
    <link rel="stylesheet" href="/js/kindeditor-4.1.10/themes/default/default.css"/>
    <script src="/js/kindeditor-4.1.10/kindeditor-all.js"></script>

    <!--引入easyui的样式 -->
    <link rel="stylesheet" href="/js/easyui1.5/themes/default/easyui.css" type="text/css"></link>
    <link rel="stylesheet" href="/js/easyui1.5/themes/icon.css" type="text/css"></link>

    <script type="text/javascript" src="/js/easyui1.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/easyui1.5/locale/easyui-lang-zh_CN.js"></script>

</head>
<body>
    <div>
        <p align="right">
        <a id="btn_day"   href="javascript:void(0)" class="easyui-linkbutton" onClick="queryCount()" data-options="iconCls:'icon-search'">日</a>
        <a id="btn_date"   href="javascript:void(0)" class="easyui-linkbutton" onClick="queryDay()" data-options="iconCls:'icon-search'">周</a>
        <a id="btn_month"   href="javascript:void(0)" class="easyui-linkbutton" onClick="queryMonth()" data-options="iconCls:'icon-search'">月</a>
        </p>
    </div>
    <table id="dg" fit="true">
    </table>
</body>
<script type="text/javascript" th:inline="none">
   $(function(){
       queryCount();
   })

    //===按点击量排序
    function queryCount(){//初始化datagrid控件
        $('#dg').datagrid({
            url:'/pank/queryPank',
            striped:true,
            toolbar: '#tb',
            pagination:true,
            pageList:[20,25,50,75,100],
            pageSize: 25, //默认显示多少条 这个值一定在pagelist中存在
            rowStyler: function(index,row){

                if (index%2==0){
                    return 'background-color:#6293BB;color:green;';
                }else{
                    return 'background-color:#6293BB;color:yellow;';
                }
            },
            loadMsg:'正在加载,别着急',
            columns:[[
                {field:"id",title:'序号',width:100,align:'center',
                    formatter: function(value,row,index){
                        return index+1;
                    }
                },
                {field:'biaoti',title:'标题',width:100,align:'center',
                    formatter: function(value,row,index){
                        return '<a href="JavaScript:void(0)" onclick="getData2(\''+row.biaoti+'\',\''+row.name+'\')">'+row.biaoti+'</a>'
                    }
                },
                {field:'name',title:'博主名字',width:100,align:'center',
                    formatter: function(value,row,index){
                        return '<a href="JavaScript:void(0)" onclick="getName2(\''+row.name+'\')">'+row.name+'</a>'
                    }
                },

                {field:'bksj',title:'博客时间',width:100,align:'center',
                    formatter: function(value,row,index){
                    var mydate = new Date(value)//格式化日期
                    var str = mydate.toLocaleDateString()//日期对象的方法
                    return str;
                  }}
            ]]

        });
    }

   //===按点击量周排序
   function queryDay(){//初始化datagrid控件
       $('#dg').datagrid({
           url:'/pank/queryDay',
           striped:true,
           toolbar: '#tb',
           pagination:true,
           pageList:[20,25,50,75,100],
           pageSize: 25, //默认显示多少条 这个值一定在pagelist中存在
           rowStyler: function(index,row){

               if (index%2==0){
                   return 'background-color:#6293BB;color:green;';
               }else{
                   return 'background-color:#6293BB;color:yellow;';
               }
           },
           loadMsg:'正在加载,别着急',
           columns:[[
               {field:"id",title:'序号',width:100,align:'center',
                   formatter: function(value,row,index){
                       return index+1;
                   }
               },
               {field:'biaoti',title:'标题',width:100,align:'center',
                   formatter: function(value,row,index){
                       return '<a href="JavaScript:void(0)" onclick="getData2(\''+row.biaoti+'\',\''+row.name+'\')">'+row.biaoti+'</a>'
                   }
               },
               {field:'name',title:'博主名字',width:100,align:'center',
                   formatter: function(value,row,index){
                       return '<a href="JavaScript:void(0)" onclick="getName2(\''+row.name+'\')">'+row.name+'</a>'
                   }
               },

               {field:'bksj',title:'博客时间',width:100,align:'center',
                   formatter: function(value,row,index){
                       var mydate = new Date(value)//格式化日期
                       var str = mydate.toLocaleDateString()//日期对象的方法
                       return str;
                   }}
           ]]

       });
   }

   //===按点击量月排序
   function queryMonth(){//初始化datagrid控件
       $('#dg').datagrid({
           url:'/pank/queryMonth',
           striped:true,
           toolbar: '#tb',
           pagination:true,
           pageList:[20,25,50,75,100],
           pageSize: 25, //默认显示多少条 这个值一定在pagelist中存在
           rowStyler: function(index,row){

               if (index%2==0){
                   return 'background-color:#6293BB;color:green;';
               }else{
                   return 'background-color:#6293BB;color:yellow;';
               }
           },
           loadMsg:'正在加载,别着急',
           columns:[[
               {field:"id",title:'序号',width:100,align:'center',
                   formatter: function(value,row,index){
                       return index+1;
                   }
               },
               {field:'biaoti',title:'标题',width:100,align:'center',
                   formatter: function(value,row,index){
                       return '<a href="JavaScript:void(0)" onclick="getData2(\''+row.biaoti+'\',\''+row.name+'\')">'+row.biaoti+'</a>'
                   }
               },
               {field:'name',title:'博主名字',width:100,align:'center',
                   formatter: function(value,row,index){
                       return '<a href="JavaScript:void(0)" onclick="getName2(\''+row.name+'\')">'+row.name+'</a>'
                   }
               },

               {field:'bksj',title:'博客时间',width:100,align:'center',
                   formatter: function(value,row,index){
                       var mydate = new Date(value)//格式化日期
                       var str = mydate.toLocaleDateString()//日期对象的方法
                       return str;
                   }}
           ]]

       });
   }

   function getData2(btname,name){

    location.href="/pank/toString?biaoti="+btname+"&author="+name;

   }


</script>
</html>